package by.ins.webconsole.jsf.actions;

import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;

import com.sun.faces.application.ActionListenerImpl;
import com.sun.faces.facelets.el.TagMethodExpression;

@Deprecated
public class ActionListener extends ActionListenerImpl implements javax.faces.event.ActionListener {

	public ActionListener() {
		super();
	}

	@Override
	public void processAction(ActionEvent event)
			throws AbortProcessingException {
		ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
		Object ma =  event.getComponent().getAttributes().get("action");
		UIComponent source = event.getComponent();
        ActionSource actionSource = (ActionSource) source;
        @SuppressWarnings("deprecation")
		Class type = actionSource.getAction().getType(FacesContext.getCurrentInstance());
        
        StringBuffer sb = new StringBuffer();
        for(Object key : event.getComponent().getAttributes().keySet() ){
        	sb.append("key: ").append(key).append(" ; value :").append(event.getComponent().getAttributes().get(key)).append("\n");
        }
        
        Object ae =   event.getComponent().getAttributes().get("actionExpression");
      //  javax.faces.component.MethodBindingMethodExpressionAdapter
        TagMethodExpression mei = (TagMethodExpression)ae;
		super.processAction(event);
		event.getSource();

	}

}
